package io.ouka.jvm;


import io.ouka.jvm.hotspot.selfread.InstanceKlass;
import io.ouka.jvm.hotspot.selfread.domain.MethodInfo;
import io.ouka.jvm.hotspot.selfread.methodinvoke.JavaNativeInterface;
import io.ouka.jvm.hotspot.selfread.methodinvoke.JavaThread;
import io.ouka.jvm.hotspot.selfread.methodinvoke.Threads;
import io.ouka.jvm.hotspot.selfread.read.*;
import io.ouka.jvm.hotspot.selfread.read.ClassLoader;
import io.ouka.jvm.hotspot.selfread.util.FileReader;


import java.io.IOException;

/**
 * @author Ouka
 */
public class Test {
    public static void main(String[] args) throws IOException {
        InstanceKlass instanceKlass = ClassLoader.loadClass("io.ouka.jvm.demo.Test");
        //多少个线程就有多少个虚拟机栈
        MethodInfo mainMethod = JavaNativeInterface.getMethodID(instanceKlass, "main", "([Ljava/lang/String;)V");
        JavaThread thread = new JavaThread();
        Threads.getThreadList().add(thread);
        Threads.setCurrentThread(thread);
        JavaNativeInterface.callStaticMethod(mainMethod);
    }
}
